import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/Container/Index'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      // redirect: '/login',
      name: 'login',
      component: () => import('@/views/Login/login.vue')
    },
    {
      path: '/home',
      name: 'home',
      redirect: '/welcome',
      component: Layout,
      children: [
        {
          path: '/welcome',
          name: 'welcome',
          component: () => import('@/views/welcome.vue')
        },
        {
          path: '/user/userList',
          name: 'userList',
          component: () => import('@/views/users/userList.vue')
        },
        {
          path: '/user/powerList',
          name: 'powerLost',
          component: () => import('@/views/users/powerList')
        },
        {
          path: '/nowPurchase',
          name: 'nowPurchase',
          component: () => import('@/views/purchase/newList.vue')
        },
        {
          path: '/oldPurchase',
          name: 'oldPurchase',
          component: () => import('@/views/purchase/oldList.vue')
        },
        {
          path: '/productOrder',
          name: 'productOrder',
          component: () => import('@/views/order/productOrder.vue')
        },
        {
          path: '/historyOrder',
          name: 'historyOrder',
          component: () => import('@/views/order/historyOrder.vue')
        }
      ]
    },
    {
      path: '/404',
      component: () => import('@/views/404'),
      hidden: true
    }
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
    // }
  ]
})
